package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.bifang.module.base.common.vo.tree.TreeVO;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduFormSpecial.EduFormSpecialKeyVO;
import com.jwsoft.manager.common.vo.eduFormSpecial.EduFormSpecialQueryVO;
import com.jwsoft.manager.common.vo.eduFormSpecial.EduFormSpecialVO;
import com.jwsoft.manager.common.vo.eduFormSpecialParams.EduFormSpecialParamsQueryVO;
import com.jwsoft.manager.core.integration.EduFormSpecialIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 特殊通道表网关
 *
 * @author wangtao
 * @since 2022-12-06
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "特殊通道表", description = "特殊通道表")
public class EduFormSpecialController {

    @Autowired
    public EduFormSpecialIntegration eduFormSpecialIntegration;

    @Operation(summary = "特殊通道表分页查询",description = "特殊通道表分页查询")
    @PostMapping(value = "/eduFormSpecial0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduFormSpecialVO>> getList(@RequestBody @Validated EduFormSpecialQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getList(vo));
    }
    @Operation(summary = "政策性安排类别分页查询",description = "政策性安排类别分页查询")
    @PostMapping(value = "/eduFormSpecialJh0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduFormSpecialVO>> getListJh(@RequestBody @Validated EduFormSpecialQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getListJh(vo));
    }
    @Operation(summary = "特殊通道表根据主键查询详情",description = "特殊通道表根据主键查询详情")
    @PostMapping(value = "/eduFormSpecial0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormSpecialVO> getById(@RequestBody @Validated EduFormSpecialKeyVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "特殊通道表新增",description = "特殊通道表新增")
    @PostMapping(value = "/eduFormSpecial0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormSpecialVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduFormSpecialVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "特殊通道表修改",description = "特殊通道表修改")
    @PostMapping(value = "/eduFormSpecial0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormSpecialVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduFormSpecialVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "特殊通道表删除",description = "特殊通道表删除")
    @PostMapping(value = "/eduFormSpecial0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduFormSpecialKeyVO vo) {
        eduFormSpecialIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "特殊通道表根据主键查询详情",description = "特殊通道表根据主键查询详情")
    @PostMapping(value = "/eduFormSpecial0007", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormSpecialVO> getByConditon(@RequestBody @Validated EduFormSpecialQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getByConditon(vo));
    }

    @Operation(summary = "获取特殊通道配置信息",description = "获取特殊通道配置信息")
    @PostMapping(value = "/eduFormSpecial0008", produces = "application/json;charset=UTF-8")
    public AppResponse getFormSpecialConfigInfo (@RequestBody @Validated EduFormSpecialParamsQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getFormSpecialConfigInfo(vo));
    }

    @Operation(summary = "特殊通道树查询",description = "特殊通道树查询")
    @PostMapping(value = "/eduFormSpecial0009", produces = "application/json;charset=UTF-8")
    public AppResponse<List<TreeVO>> getFormSpecialTree(@RequestBody @Validated EduFormSpecialQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getFormSpecialTree(vo));
    }


    @Operation(summary = "义务招生方案特殊类别查询",description = "义务招生方案特殊类别查询")
    @PostMapping(value = "/eduFormSpecial0010", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduFormSpecialVO>> getFormSpecialInfo(@RequestBody @Validated EduFormSpecialQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getFormSpecialInfo(vo));
    }

    @Operation(summary = "复制上年特殊通道",description = "复制上年特殊通道")
    @PostMapping(value = "/eduFormSpecial0011", produces = "application/json;charset=UTF-8")
    public AppResponse copyLastYearSpecial(@RequestBody @Validated EduFormSpecialVO vo) {
        eduFormSpecialIntegration.copyLastYearSpecial(vo);
        return AppResponse.success();
    }

    @Operation(summary = "特殊通道人员管理通道树查询",description = "特殊通道人员管理通道树查询")
    @PostMapping(value = "/eduFormSpecial0012", produces = "application/json;charset=UTF-8")
    public AppResponse<List<TreeVO>> getSpecialManagerTree(@RequestBody @Validated EduFormSpecialQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getSpecialManagerTree(vo));
    }

    @Operation(summary = "特殊通道人员管理通道树查询", description = "特殊通道人员管理通道树查询")
    @PostMapping(value = "/eduFormSpecial0013", produces = "application/json;charset=UTF-8")
    public AppResponse<EduFormSpecialVO> getBySmallValue(@RequestBody @Validated EduFormSpecialQueryVO vo) {
        return AppResponse.successData(eduFormSpecialIntegration.getBySmallValue(vo));
    }

}
